package com.starview.star.compiler.util;

import java.util.ArrayList;
import java.util.List;

public class ListUtils
{

  public static <T> List<T> mergeLists(List<T> l1, List<T> l2)
  {
    List<T> result = new ArrayList<T>(l1);
    for (T el : l2)
      if (!result.contains(el))
        result.add(el);
    return result;
  }

  public static <T> boolean isSubset(List<T> set, List<T> sub)
  {
    for (T el : sub)
      if (!set.contains(el))
        return false;
    return true;
  }

  public static <T> boolean assertNoNulls(T args[])
  {
    for (T el : args)
      if (el == null)
        return false;
    return true;
  }

  public static <T> boolean assertNoNulls(List<T> args)
  {
    for (T el : args)
      if (el == null)
        return false;
    return true;
  }

}
